<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>Айболит</title>
        <link type="text/css" rel="stylesheet" href="resources/css/default.css" />   
    </h:head>
    <h:body>

        <table width="100%" border="1">
            <tr>
                <td width="100%">
                    <table width="100%" border="1" align="center">

                        <td align="center">
                            <ui:include src="fortop.xhtml"/>

                        </td>
                    </table>
                </td>
            </tr>

            <tr>
                <table width="100%" border="1" align="top" height="600px" >
                    <td width="15%" valign="top">
                        <ui:include src="left.xhtml"/>
                    </td>
                    <td width="75%" align="left" valign="top">
                        <table align="top" width="100%">
                            <tr>
                                <td align="center">
                                    <p:panel>
                                        <h:form>
                                            <p:inputText size="70" id="findText" />
                                            <p:watermark for="findText" value="Поиск" />  
                                            <p:spacer width="2"/>  
                                            <p:commandButton ajax="false"  style="text-align: center" value="Поиск" icon="ui-icon-search" iconPos="right" action="reg_pacient.xhtml"/>
                                            <p:commandButton ajax="false" style="text-align: center" value="Расширенный поиск" action="reg_pacient.xhtml"/> 
                                            <!--<p:spacer width="5"/>-->  
                                        </h:form>
                                    </p:panel>
                                </td>
                            </tr>
                        </table> 
                        <table border="1" width="100%" >
                            <tr>
                                <td width="33%">
                                    <h:form id="pacient">

                                        <p:dataGrid id="ggg2" var="neopred" value="#{pacient.getPacientsWithbyStatus('4')}" columns="1" paginator="false"  emptyMessage="Зарегистрируйте палаты"
                                                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                    paginatorPosition="bottom" style="border-radius: 10px;" >
                                            <p:column>
                                                <p:commandButton style="width: 100%; text-align: left"  value="#{neopred.lastName}  #{neopred.name} #{neopred.midName}" actionListener="#{pacient.pacientName(neopred.name,neopred.patientId)}" ajax="true" update=":text,:chamber" id="get"/>
                                            <p:blockUI block=":pacient" trigger="get" />
                                        </p:column>
                                           
                                        </p:dataGrid>
                                    </h:form>
                                    
                                    
                                </td>
                                <td width="33%" valign="top">
                                <h:form id="chamber">
                                    <p:dataGrid id="ggg" var="cham" value="#{chambers.getChambersList()}" columns="1" paginator="false"  emptyMessage="Зарегистрируйте плалты"
                                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                paginatorPosition="bottom" style="border-radius: 10px;" rendered="#{pacient.fl == 1}">
                                        <p:commandButton style="width: 100px; text-align: left"  value="#{cham.name}  (#{chambers.getBuzyBeds(cham.chamberId)}/#{cham.bedsesByChamberId.size()})" actionListener="#{chambers.freeBeds(cham.chamberId,cham.name)}" ajax="true" update=":beds"/>
                                    </p:dataGrid>                                    
                                </h:form>
                            </td>
                            <td width="33%" valign="top">
                                <h:outputText id="text" value="#{pacient.name}"/>
                                <h:form id="beds">
                                     
                                    <p:dataGrid id="hhh" var="beds11" value="#{chambers.getFreeBedsList()}" columns="1" paginator="false" emptyMessage="Нет свободных коек"  
                                                paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rows="5" 
                                                paginatorPosition="bottom"  >
                                        <p:column>
                                            <p:commandButton style="width: 100%;text-align: left" value="№#{beds11.bedId}   #{beds11.patientesByPatientId.name}" action="#{chambers.freeBeds('0','')}" actionListener="#{pacient.changePacientStatus(beds11.bedId)}" id="regbed"  ajax="true" update=":bigchamber,:beds,:pacient,:chamber,:text"/>
                                        </p:column>
                                     <p:blockUI block=":beds" trigger="regbed" />
                                    </p:dataGrid>   
                                </h:form>
                            </td>
                                
                                

                            </tr>
                            </table>
                        <table width="100%">
                            <tr>
                                <td width="50%" valign="top">

                                    <h:form id="bigchamber">

                                        <p:dataGrid id="allchambers" var="cham" value="#{chambers.getChambersList()}" columns="1" paginator="false"  emptyMessage="Зарегистрируйте плалты"
                                                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                    paginatorPosition="bottom" style="border-radius: 10px;" >
                                            <h:outputLabel style="text-align: center;font-size: 20px" value="#{cham.name} (#{chambers.getBuzyBeds(cham.chamberId)}/#{cham.bedsesByChamberId.size()})"/>
                                            <p:dataGrid id="allchambersin" var="bedss" value="#{beds.getBadsListbyChamberID(cham.chamberId)}" columns="1" paginator="false"  emptyMessage="Зарегистрируйте плалты"
                                                        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                                                        paginatorPosition="bottom" style="border-radius: 10px;" >
                                                <p:commandButton style="width: 100%;text-align: left;background-color: #6CE26C" 
                                                                 value="#{bedss.bname} #{bedss.patientesByPatientId.name}" 
                                                                 action="#{chambers.go}" 
                                                                 actionListener="#{chambers.go1(bedss.patientesByPatientId.name)}" 
                                                                 disabled="#{empty bedss.patientesByPatientId.name}" 
                                                                 ajax="false">
                                                    <f:param name="pname" value="#{bedss.patientesByPatientId.patientId}" />
                                                </p:commandButton>

                                            </p:dataGrid>
                                        </p:dataGrid>
                                    </h:form>
                                </td>
                                <td width="50%" valign="top">
                                    <h:form id="forma">
                                        <h:outputLabel value="#{chambers.chamberName}"/>

                                    </h:form>
                                </td>
                            </tr>
                        </table>
                    </td>
                </table>
            </tr>
        </table> 

    </h:body>
</html>

